﻿<script type="text/x-jqote-template" id="input_tpl">
  <![CDATA[   
		<%     
    switch(this.type){
			case "text":
				%>
         <div class="form-group">
					<label><%= this.label %></label>
					<input type="text" name="<%= this.name %>" value="<%= this.value %>" class="form-control" />
          </div>
				<%			
			break;
      case "editor":
				%>
        <div class="form-group">
					<label><%= this.label %></label>
					<textarea id="tinymce" class="form-control"><%= this.value %></textarea>
          <textarea name="<%= this.name %>" style="display:none" ></textarea>
          </div>
				<%			
			break;
      case "textarea":
				%>
        <div class="form-group">
					<label><%= this.label %></label>
					<textarea name="<%= this.name %>" rows="5" class="form-control"><%= this.value %></textarea>
          </div>
				<%			
			break;

			case "hidden":
				%>
					<input type="hidden" name="<%= this.name %>" value="<%= this.value %>" />
				<%			
			break;

			case "button":
				%>					
					<input type="button" name="<%= this.name %>" value="<%= this.value %>" />
				<%			
			break;

			case "checkbox":
      %><div class="checkbox"><label><%
			if(this.checked){
				%>					
					<input type="checkbox" name="<%= this.name %>" value="<%= this.value %>" checked="checked" />	
				<%
			}else{
				%>					
					<input type="checkbox" name="<%= this.name %>" value="<%= this.value %>" />
					
				<%
			}%><%= this.label %></label></div><%          
			break;
      
      
      
      
      
      case "groupradio":
			%><label><%= this.label %></label><%
				var obj, i, n;					
				for ( i = 0,n = this.array.length; i < n; i++ ) {
                 obj = this.array[i];
				 if(obj.checked){
					 %>						
						<input type="radio" name="<%= obj.name %>" value="<%= obj.value %>" checked="checked" />	
						<label><%= obj.text %></label>	
					 <% 
				 }else{
					 %>						
						<input type="radio" name="<%= obj.name %>" value="<%= obj.value %>" />
						<label><%= obj.text %></label>			
					 <%
				 }
			}
			%></br><%		
			break;

			case "groupcheckbox":
			%><div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title"><label><%= this.label %></label></h3></div><div class="panel-body"><%
				var obj, i, n;					
				for ( i = 0,n = this.array.length; i < n; i++ ) {
                 obj = this.array[i];
				 if(obj.checked){
					 %><div class="checkbox">	<label>					
						<input type="checkbox" name="<%= obj.name %>" value="<%= obj.value %>" checked="checked" />	
						<%= obj.text %></label></div>
					 <% 
				 }else{
					 %><div class="checkbox"><label>				
						<input type="checkbox" name="<%= obj.name %>" value="<%= obj.value %>" />
						<%= obj.text %></label></div>
					 <%
				 }
			}	
			%></div></div><%		
			break;

			case "select":
				%><div class="form-group"><label><%= this.label %></label><select name="<%= this.name %>" class="form-control"><%
				var obj, i, n;
					for ( i = 0,n = this.array.length; i < n; i++ ) {
						obj = this.array[i];
						if(obj.selected){
						%>
							<option value="<%= obj.value %>" selected="selected" ><%= obj.text %></option>			
						<% 
						}else{
						%>
							<option value="<%= obj.value %>" ><%= obj.text %></option>			
						<%
				 }
			}
			%></select></div><%
			break;
			
			case "multiselect":
				%><div class="form-group"><label><%= this.label %></label><select multiple="multiple" name="<%= this.name %>" class="form-control"><%
				var obj, i, n;
					for ( i = 0,n = this.array.length; i < n; i++ ) {
						obj = this.array[i];
						if(obj.selected){
						%>
							<option value="<%= obj.value %>" selected="selected" ><%= obj.text %></option>			
						<% 
						}else{
						%>
							<option value="<%= obj.value %>" class="quan" ><%= obj.text %></option>			
						<%
				 }
			}
			%></select></div><%
			break;
      
		}%>
    ]]>
</script>

